/**
 * Created by xinchunting on 17-11-14.
 */
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 * 鍏叡鍑芥暟搴�
 */

$(function() {
    //琛ㄥ崟鎻愪氦
    form_submit = function(form) {
        url=form.attr("action");
        $.ajax({
            cache: true,
            type: "POST",
            url:url,
            data:form.serialize(),
            async: false,
            success: function(json) {
                json=eval('(' +json+ ')');
                if(json.errcode!='1'){
                    $.toast(json.errmsg);
                    return false;
                }
                $.toast(json.errmsg);
                if (json.errcode && json.url !=='') {
                    setTimeout(function() {
                        window.location.href =json.url;
                    }, 1000);
                } else {
                    return false;
                }
            }
        });
    } ;

    // 濡傛灉鍚庨€€鐨勫煙鍚嶆槸鍚屽煙鐨� url锛屽垯鎵ц鍚庨€€锛屽惁鍒欑洿鎺ラ噸瀹氬悜鍒颁富椤点€�
    /*go_back = function() {
     if (document.referrer && /\/\/([^\/]+)/.exec(document.referrer)[1] === location.host) {
     history.go(-1);
     } else {
     window.location.href = '/';
     }
     };*/

});

//绯荤粺妯″潡鍗囩骇涓彁绀�
function upgrading(){
    $.toast('姝ゆā鍧楀崌绾т腑');
    return false;
}


/**
 * 鍥剧墖鍔犺浇
 */
function lazyLoad(){
    $('.lazyload').each(function(){
        var url = $(this).attr('data-original');
        var img = new Image();
        img.src = url;
        var that = $(this);
        img.onload = function(){
            that.attr('src',url);
        }
    });
}


